﻿using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using NiuX.Domain.Entities;
using NiuX.Domain.Specifications;

namespace NiuX.Domain.Repositories
{
    public partial interface IRepository<TEntity> where TEntity : EntityBase
    {
        Task<TEntity> InsertNowAsync([NotNull] TEntity entity, CancellationToken cancellationToken = default);

        Task InsertManyNowAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default);

        Task DeleteNowAsync([NotNull] TEntity entity, CancellationToken cancellationToken = default);

        Task DeleteNowAsync([NotNull] Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken = default);

        Task DeleteManyNowAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default);

        Task<TEntity> UpdateNowAsync([NotNull] TEntity entity, CancellationToken cancellationToken = default);

        Task UpdateManyNowAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default);
    }

    public partial interface IRepository<TEntity, in TKey> : IRepository<TEntity> where TEntity : EntityBase<TKey>
    {
        Task DeleteNowAsync(TKey id, CancellationToken cancellationToken = default);


        Task DeleteManyNowAsync(IEnumerable<TKey> ids, CancellationToken cancellationToken = default);
    }


}
